# 04-循环读取文件.py

f = open('./01-test.txt',"r",encoding="utf-8")
# for x in f:
#     print(x) # x表示文件中的每一行

# 
while True:
    a = f.readline();
    if not a:
        break;
    print(a)

# 关闭文件
f.close()
# with 声明的文件读取会自动关闭
with open('./01-test.txt',"r",encoding="utf-8") as file:
    for x in file:
        print(x)